﻿using Xejen.Ipc.Framework.Flows;
using System;
using System.Collections.Generic;
using System.Text;

namespace Xejen.Ipc.Framework.Steps
{
    /// <inheritdoc cref="IStepInstance"/>
    /// <typeparam name="TData"><inheritdoc cref="IFlow{TData}" path="/typeparam[@name='TData']"/></typeparam>
    internal class StepInstance<TData> : IStepInstance
        where TData : new()
    {
        /// <inheritdoc/>
        public int Id { get; set; }
        /// <inheritdoc/>
        public string Name { get; set; }

        /// <inheritdoc/>
        public DateTime? CycleStartTime { get; set; }

        /// <inheritdoc/>
        public DateTime? CycleEndTime { get; set; }

        /// <inheritdoc/>
        public TimeSpan? CycleExecutionTime { get; set; }

        /// <inheritdoc cref="StepInstance{TData}"/>
        /// <param name="step"><inheritdoc cref="IStep{TData}" path="/summary"/></param>
        public StepInstance(IStep<TData> step)
        {
            Check.NotNull(step, nameof(step));

            Id = step.Id;
            Name = step.Name;
        }
    }
}
